import QtQuick 2.4
import QtQuick.Controls 1.2
import SWTGraph 1.0
import "../js/graphFactory.js" as GraphFactory
ApplicationWindow {
    visible: true
    width: 640
    height: 480
    Rectangle{
        id:graphView
        anchors.fill: parent;
        MouseArea {
            hoverEnabled:true
            anchors.fill: parent
            onPressed: GraphFactory.mousePressed(mouse);
            onPositionChanged:GraphFactory.mouseMove(mouse);
        }
    }
    Rectangle{
        id:graphPlate
        color: "black"
        anchors.left: graphView.right
        width:100
        height:100
    }

//    SWTLine {
//        x:Math.random() * 640.0
//        y:Math.random() * 480.0
//        p1: Qt.point(30, 50)
//        p2: Qt.point(30, 100)
//    }
//    WorkerScript {
//        id: worker
//        source: "../js/graphFactory.js"
//    }
//    Timer {
//        id: timer
//        interval: 10;
//        repeat: true
//        running: true
//        onTriggered: {
//            if(GraphFactory.newGraph)
//                GraphFactory.newGraph.update();
////            var msg = {'action': 'create',graphType:'Line', 'parentItem': graphView};
////            GraphFactory.createGraph(msg);

////            worker.sendMessage(msg);
////            var newObject = Qt.createQmlObject('import SWTGraph 1.0; SWTLine {x:Math.random() * 640.0;y:Math.random() * 480.0;p1: Qt.point(30, 50);p2: Qt.point(30, 100)}',
////                graphView);
//        }
//    }
}

